#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
vector<int> partitionLabels(string s) {
  unordered_map<char, int> r_bound;
  int slice_len = 0;
  int max_length = 0;
  for (int i = 0; i < s.size(); ++i) {
    r_bound[s[i]] = i;
  }
  vector<int> res;
  for (int i = 0; i < s.size(); ++i) {
    max_length = max(max_length, r_bound[s[i]]);
    slice_len++;
    if (max_length == i) {
      res.push_back(slice_len);
      slice_len = 0;
    }
  }
  return res;
}